package com.example.jetpacktest.adapter

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.jetpacktest.R

class DiffUtilsTest001Adapter(var datas: List<String>, val context: Context): RecyclerView.Adapter<DiffUtilsTest001Adapter.MyViewHolder>() {

    private val TAG: String = this.javaClass.simpleName

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
        return MyViewHolder(LayoutInflater.from(context).inflate(R.layout.item_diff_util_test001, parent, false))
    }

    override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
        Log.d(TAG, "position = $position")
        holder.textView.text = datas[position]
    }

    override fun getItemCount(): Int {
        return datas.size
    }



    class MyViewHolder(itemView: View): RecyclerView.ViewHolder(itemView){
        val textView: TextView = itemView.findViewById<TextView>(R.id.textView)
    }


}